package com.ztom.context.support

import com.ztom.beans.factory.DefaultListableBeanFactory
import com.ztom.beans.factory.support.reader.xml.XmlBeanDefinitionReader

/**
 * @author ZhangTao
 */
abstract class AbstractXmlApplicationContext : AbstractRefreshableApplicationContext() {

    override fun loadBeanDefinitions(beanFactory: DefaultListableBeanFactory) {
        val xmlReader = XmlBeanDefinitionReader(beanFactory)
        val configLocations = getConfigLocations()
        configLocations?.let {
            xmlReader.loadBeanDefinitions(it)
        }
    }

    protected abstract fun getConfigLocations(): Array<String>?
}